<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:isUserInRole roles="forum-post-viewEmail" var="canViewEmail" />

<jsp:include page="/WEB-INF/pages/forum/pathFragment.jsp" />

<atleap:messages />
<c:if test="${requestScope.currentPost != null}">
    <atleap:message key="forum.topic.form.openTopic" var="openTopicTitle" />
    <table border="0" cellpadding="0" cellspacing="0" class="postList" id="postList">
        <tr class="evenPost">
            <td width="20%" valign="top" align="center">
                <c:out value="${currentPost.author}" escapeXml="true" />
                <c:if test="${canViewEmail}">
                    <c:set var="email" value="${currentPost.email}" />
                    <c:if test="${!empty email}">
                        <c:set var="escapedEmail">
                            <c:out value="${email}" escapeXml="true" />
                        </c:set>
                        <br />
                        (<a href="mailto:${escapedEmail}">${escapedEmail}</a>)
                    </c:if>
                </c:if>
            </td>
            <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="postInternalTable">
                    <tr>
                        <td class="postTitleCell">
                            <atleap:formatDate value="${currentPost.date}" type="datetime" />
                            <strong><atleap:message key="forum.post.form.subject" />:</strong>
                            <c:out value="${currentPost.subject}" escapeXml="true" />
                        </td>
                    </tr>
                    <tr>
                        <td class="postInternalCell">
                            ${currentPost.body}
                        </td>
                    </tr>
                    <tr>
                        <td class="postInternalCell">
                            <atleap:link action="forum/topic${currentPost.topic.id}" title="${openTopicTitle}">
                                ${openTopicTitle}
                            </atleap:link>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</c:if>
